package alg;

import java.util.Arrays;



class Solution1 {
    public int[] moveZeroes(int[] nums) {
        int dest = -1,n = nums.length;
        for (int cur = 0; cur < n; cur++) {
            if (nums[cur] != 0) {
                dest++;
                int tmep = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmep;
            }
        }
        return nums;
    }

    public static void main(String[] args) {

        Solution1 solution1 = new Solution1();
        int[] ret = {1,4,5,0,5,0,0,12};
        System.out.println(Arrays.toString(solution1.moveZeroes(ret)));
    }
}
